package com.srd.phone.activity;

import android.os.Bundle;
import android.os.CountDownTimer;
import android.view.View;
import android.widget.TextView;

import com.shengrongdai.srd.R;

/**
 * 竞拍成功，投资成功界面
 */
public class TenderSuccessActivity extends BaseActivity {

    private TextView tv_time_value;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_tender_success);
        tv_common_title.setText("立即投资");
        tv_time_value = (TextView)findViewById(R.id.tv_time_value);
        findViewById(R.id.bt_back).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        downTimer.start();
    }

    CountDownTimer downTimer = new CountDownTimer(1000 * 11, 1000) {
        @Override
        public void onTick(long millisUntilFinished) {
            long second = millisUntilFinished / 1000;
            setTextSpan(tv_time_value, second + "s");
        }

        @Override
        public void onFinish() {
            finish();
        }
    };

    @Override
    protected void onDestroy() {
        super.onDestroy();
        downTimer.cancel();
    }

    public void setTextSpan(TextView tv, String strs) {
        tv.setText("投资成功");
        tv.append(strs);
        tv.append("内自动返回债权转让列表页面");
    }
}
